package com.sichem.domain.activity.service.trial.factory;

import com.sichem.domain.activity.model.entity.MarketProductEntity;
import com.sichem.domain.activity.model.entity.TrialBalanceEntity;
import com.sichem.domain.activity.model.valobj.GroupBuyActivityDiscountVO;
import com.sichem.domain.activity.model.valobj.SkuVO;
import com.sichem.domain.activity.service.trial.node.RootNode;
import com.sichem.types.design.framework.tree.StrategyHandler;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * @Author xiangshizhen
 * @Date 2025/2/8
 */

@Service
public class DefaultActivityStrategyFactory {

    private final RootNode rootNode;

    public DefaultActivityStrategyFactory(RootNode rootNode) {
        this.rootNode = rootNode;
    }

    public StrategyHandler<MarketProductEntity, DefaultActivityStrategyFactory.DynamicContext, TrialBalanceEntity> strategyHandler(){
        return rootNode;
    }

    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    public static class DynamicContext{
        /**
         * 活动对象
         */
        private GroupBuyActivityDiscountVO groupBuyActivityDiscountVO;

        /**
         * 商品信息
         */
        private SkuVO skuVO;

        /**
         * 折扣的价格
         */
        private BigDecimal deductionPrice;

        /**
         * 支付价格
         */
        private BigDecimal payPrice;

        private boolean visible;

        private boolean enable;

    }
}
